let express = require('express');
//引入body-parser模块儿,用来解析post请求参数
let bodyParser = require('body-parser');
//创建应用实例
let app = express();
//注册中间件(使用动态资源文件夹)
app.use(express.static('public'));
app.use(bodyParser.urlencoded({extended:true}));
app.get('/login',(req,res) =>{
  console.log(req);
  console.log(req.query.username);
  console.log(req.query.password);
  res.send(`恭喜用户${res.query.username}提交成功了`)
});
app.post('/user/like',(req,res) =>{
    console.log('post请求进来了');
    console.log(req.body);
    console.log(req.body.like);
    res.send('请求成功')  
});
//监听端口
app.listen(8080,function(){
  console.log('服务器已启动');
});